from pyecharts.charts import Map
from pyecharts import options as opts
from pyecharts.globals import ThemeType
from Test.dataSource.Data import dataB
data1 = [list(z) for z in zip(dataB["省市地区"].to_list(), dataB["新增确诊"].to_list())]
data_xz = dataB.loc[dataB['新增确诊'] == 0, :]
data_xz1 = [list(z) for z in zip(data_xz["省市地区"].to_list(), data_xz["新增确诊"].to_list())]
map1 = (
    Map(init_opts=opts.InitOpts(width="700px", height="700px", theme=ThemeType.LIGHT))
        .add("", data1, "china")
        .set_series_opts(showLegendSymbol=False)
        .add("", data_xz1, "china", itemstyle_opts=opts.ItemStyleOpts(color="red", ), )
        .set_global_opts(
        title_opts=opts.TitleOpts(
            title="各省市新增确诊分布情况",
            pos_top='20%', pos_left='35%',
            title_textstyle_opts=opts.TextStyleOpts(color='#CCFFFF', )),
        visualmap_opts=opts.VisualMapOpts(is_piecewise=False, pos_top='82%', pos_left='30%',
                                          orient="horizontal",
                                          range_text=['以上', ' '],
                                          range_color=['#FFFFFF', '#0099CC'],
                                          max_=200,
                                          item_width=30,
                                          item_height=300,
                                          ),
    )
)
map1.render("../TestHTML/TestHtml-b/map.html")
